Skip to content

[Bugfix #1941] consult claude lane: mode-aware login advice, set-based tool guard, npm install hint, configurable caps, docs - #1942

Draft
waleedkadous wants to merge 7 commits into
mainfrom
builder/bugfix-1941
Draft

waleedkadous wants to merge 7 commits into
mainfrom
builder/bugfix-1941

Conversation

@waleedkadous

Copy link
Copy Markdown
Contributor

Fixes #1941

Five follow-ups to the consult claude lane, found by the live review after it moved to the installed claude CLI (#1912).

Problem → root cause → fix

  1. Wrong advice in api-key mode. assertLoggedIn always said Run `claude auth login` , and a review result saying Not logged in · Please run /login was quoted with no remedy beyond the CLI's own /login. In api-key mode the fix is the key. A new claudeLoginRemedy(mode, source) gives the remedy for the mode: claude auth login in login mode; in api-key mode it names consult.claudeAuth and the file that set it, and says to check the key or remove the setting. It is used by the preflight, by codev doctor, and by classifyClaudeRun when an error result says the session is not logged in. Probed on the real claude 2.1.330: with any key set (even a bogus one) auth status reports loggedIn: true, so the preflight branch is defensive today. With no login, a print-mode run ends with Not logged in · Please run /login (is_error: true, subtype success).
  2. Tool guard failed on a harmless duplicate. The init guard also required tools.length === 3. It now compares sets: the session must report exactly Read, Glob, Grep. A duplicate is fine; an extra tool (the security half) or a missing tool still aborts.
  3. Install hint named only curl. CLAUDE_INSTALL_HINT now names both routes (native installer and npm install -g @anthropic-ai/claude-code), like CLAUDE_UPDATE_HINT.
  4. Hard-coded caps. New consult.claudeMaxTurns (positive integer, default 200) and consult.claudeMaxBudgetUsd (positive number, default 25), validated at config load beside claudeAuth; a bad value fails loudly. The cap-reached messages name the configured value and the key to raise.
  5. Docs. README and INSTALL state the claude 2.1.141 minimum. consult.md (both trees), the consult SKILL.md (all four copies) and the arch.md lane row say that withholding the API key is a billing guarantee, not secrecy: the reviewer can still read the workspace .env with its Read tool. consult.md documents the two new keys.

Also in this PR: shipped-skill-hashes.ts regenerated for the SKILL.md edit (the skill-refresh test requires it).

Noticed, not changed: when the lane is called directly with an invalid config, it throws in resolveLaneModelChoice before its try, so a stale --output file survives. That is already true for a bad claudeAuth, and real consult loads config before any lane runs.

Testing

  • New and updated tests: a logged-out status and a logged-out review result in each auth mode (lane, preflight, codev doctor); an unrelated error result gets no remedy; a duplicated tool list runs the review, while an extra or missing tool aborts; configured caps reach the claude argv and the cap messages; bad cap values are rejected at config load and fail the lane before any review; the not-found message names npm.
  • Regression check: with the five source files reverted to the pre-fix versions, 25 of these tests fail, across all four code points. With the fix, claude-cli.test.ts, claude-cli-lane.test.ts and doctor.test.ts pass: 209 passed, 1 skipped.
  • Build passes. tsc --noEmit is clean.

Flaky Tests

The full suite, run locally through porch's tests check, failed four times, each time on a different test. The load average was 29–54 from other workspaces (once 14 at the start, rising to 39 during the run). None of these tests touches this change, and each passes alone:

Test Full-suite run Alone
src/__tests__/windows-console-spawn-guard.test.ts failed 7/7 passed
src/agent-farm/__tests__/ide-command.test.ts failed (11.6s) 21/21 passed
src/agent-farm/__tests__/bugfix-1267-launch-loop.test.ts failed (21.1s) 7/7 passed
src/commands/consult/__tests__/agy-auth-cache.test.ts failed (27.2s) 27/27 passed

This draft PR is open so CI runs the full suite on a clean runner. porch's local tests check has not passed.

…install hint, caps, docs)

- A logged-out answer gets the remedy for the auth mode: `claude auth login`
  in login mode, the key and consult.claudeAuth in api-key mode. Applies to
  the auth-status preflight, codev doctor, and a review result that says the
  session is not logged in (claudeLoginRemedy).
- The init tool guard compares tool lists as sets: a duplicate is fine; an
  extra or a missing tool still aborts the review.
- CLAUDE_INSTALL_HINT names both the native installer and npm.
- consult.claudeMaxTurns / consult.claudeMaxBudgetUsd make the 200-turn and
  $25 caps configurable, validated at config load; cap-reached messages name
  the configured value and the key to raise.
- Docs: claude 2.1.141 minimum in README/INSTALL; withholding the API key is a
  billing guarantee, not secrecy (consult.md, consult SKILL.md, arch.md).
…onfigurable caps

- Logged-out auth status and a logged-out review result, in each auth mode
  (lane, preflight and doctor); an unrelated error result gets no remedy.
- A duplicated tool list runs the review; an extra or missing tool aborts.
- Configured caps reach the claude argv and the cap-reached messages; bad
  values are rejected at config load and fail the lane before any review.
- The not-found message names the npm install route.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

consult claude lane: five follow-ups from the live review (api-key logged-out advice, tool-guard duplicates, npm install hint, configurable caps, docs)

1 participant